<?php
namespace app\shouyin\model;

use think\Model;
use app\product\model\Product as ProductModel;
use think\Db;
class Deposit extends Model
{
    protected $field = true;
    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    // 自动写入时间戳
    protected $autoWriteTimestamp = true;

    public function getTaketimeTextAttr($value)
    {
        return date('Y-m-d H:i:s',$value);
    }
    public function getUserNameAttr($value)
    {
        $userName = Db::name('user')->where('id', $value)->value('nick');
        return $userName;
    }
    public function getProductNameAttr($value)
    {
        $productName = Db::name('product')->where('id', $value)->value('name');
        return $productName;
    }
    public function getAdminNameAttr($value)
    {
        $adminName = Db::name('system_user')->where('id', $value)->value('nick');
        return $adminName;
    }

}
